home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib43 / mntlib / tcflow.c < prev    next >
C/C++ Source or Header  |  1993-10-11  |  685b  |  43 lines

  1. /*
  2. Public domain termios tcflow() for the MiNT library
  3. 10 October 1993 entropy@terminator.rs.itd.umich.edu -- first attempt
  4. */
  5.  
  6. #include <mintbind.h>
  7. #include <errno.h>
  8. #include <ioctl.h>
  9. #include <types.h>
  10. #include <termios.h>
  11.  
  12. int
  13. tcflow(fd, action)
  14.   int fd;
  15.   int action;
  16. {
  17.   long r;
  18.  
  19.   switch (action)
  20.   {
  21.     case TCOOFF:
  22.       r = Fcntl((short) fd, (long) 0, TIOCSTOP);
  23.       break;
  24.     case TCOON:
  25.       r = Fcntl((short) fd, (long) 0, TIOCSTART);
  26.       break;
  27.     case TCIOFF:
  28.       r = -EINVAL;
  29.       break;
  30.     case TCION:
  31.       r = -EINVAL;
  32.       break;
  33.     default:
  34.       r = -EINVAL;
  35.       break;
  36.   }
  37.   if (r < 0) {
  38.     errno = (int) -r;
  39.     return -1;
  40.   }
  41.   return 0;
  42. }
  43.